class CreateWorks < ActiveRecord::Migration
  def self.up
    create_table :works do |t|
      t.integer :type_of_work_id, :collection_id, :source_id
      t.string :title
      t.datetime :publication_date
      t.timestamps
      
      t.foreign_key :type_of_work_id, :types_of_work, :id
      t.foreign_key :collection_id, :collections, :id
      t.foreign_key :source_id, :sources, :id
    end
  end

  def self.down
    drop_table :works
  end
end
